import { storage } from "./index"

const CacheKey = {
  TOKEN: `${import.meta.env.VITE_APP_SYSTEM_KEY}-token-key`,
  SIDEBAR_STATUS: `${import.meta.env.VITE_APP_SYSTEM_KEY}-sidebar-status-key`,
}

export const getSidebarStatus = () => (storage(CacheKey.SIDEBAR_STATUS) === 'false' ? false : true)
export const setSidebarStatus = sidebarStatus => storage(CacheKey.SIDEBAR_STATUS, sidebarStatus)
export const getToken = () => storage(CacheKey.TOKEN)
export const setToken = token => storage(CacheKey.TOKEN, token)
export const removeToken = () => storage(CacheKey.TOKEN, null)
export const setUserInfo= userInfo => storage('userInfo', userInfo)
export const getUserInfo = () => storage('userInfo')
